# coding=utf-8

from data import *

if __name__ == "__main__":

    wb = load_workbook(filename=u'地方政府债券基本要素.xlsx')
    ws = wb[u"Wind资讯"]

    columns_number = dict()
    i = 1
    while ws.cell(row=1, column=i).value is not None:
        columns_number[ws.cell(row=1, column=i).value] = i
        i = i + 1

    i = 1
    while ws.cell(row=i, column=1).value is not None:
        i = i + 1
    total_line_number = i - 1

    fill_years(ws, tuple(ws.columns), columns_number, total_line_number)

    fill_column(ws, tuple(ws.columns), columns_number, total_line_number, u"财政收入增长率", make_dict(u"财政收入增长率.xlsx", 'Sheet2'))
    fill_column(ws, tuple(ws.columns), columns_number, total_line_number, u"GDP", make_dict(u"GDP，增速，人均GDP.xlsx", 'GDP'))
    fill_column(ws, tuple(ws.columns), columns_number, total_line_number, u"GDP增速", make_dict(u"GDP，增速，人均GDP.xlsx", u'GDP增速'))
    fill_column(ws, tuple(ws.columns), columns_number, total_line_number, u"人均GDP", make_dict(u"GDP，增速，人均GDP.xlsx", u'人均GDP'))
    fill_column(ws, tuple(ws.columns), columns_number, total_line_number, u"债务负担率", make_dict(u"债务负担率.xlsx", 'Sheet3'))
    fill_column(ws, tuple(ws.columns), columns_number, total_line_number, u"地方公共财政收入", make_dict(u"地方公共财政收入.xlsx", 'Sheet2'))
    fill_column(ws, tuple(ws.columns), columns_number, total_line_number, u"财政收入增长率", make_dict(u"财政收入增长率.xlsx", 'Sheet2'))


    wb.save(u'结果.xlsx')